/***************************************************************************
 *   Copyright (C) 2009 by Marian Skvarek   *
 *   skvarek.marian@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include "CNoteGroupTablature.h"

namespace easyscore
{
    namespace core
    {

        //Constructors, Initialization & Destructors
        CNoteGroupTablature::CNoteGroupTablature()
        {
            initialize();
        }

        void CNoteGroupTablature::initialize()
        {
            for(int i = 0; i < STRING_COUNT; ++i)
                mPositions[i] = POSITION_NONE;
        }

        CNoteGroupTablature::CNoteGroupTablature(const CNoteGroupTablature &image)
        {
            initialize();
            for(int i = 0; i < STRING_COUNT; ++i)
                mPositions[i] = image.mPositions[i];
        }

        void CNoteGroupTablature::clear()
        {

        }

        CNoteGroupTablature::~CNoteGroupTablature()
        {
            clear();
        }

        //Overrides

        //Public methods
        void CNoteGroupTablature::set(STRING_NAME string, FRETBOARD_POSITION position)
        {
            if(string >= 0 && string < STRING_COUNT)
                mPositions[string] = position;
        }

        FRETBOARD_POSITION CNoteGroupTablature::get( STRING_NAME string )
        {
            if(string >= 0 && string < STRING_COUNT)
               return mPositions[string];

            return false;
        }

        QString CNoteGroupTablature::toString()
        {
            QString result;
            for(int i = 0; i < STRING_COUNT; ++i)
            {

                if(mPositions[i] == POSITION_NONE)
                    result.append('-');
                else
                    result.append(QString::number(mPositions[i]));
            }

            return result;

        }

        //Protected methods

        //Private methods

    }//namespace utils
}//namespace easyscore
